package com.hnzq.cloud;


import com.fasterxml.jackson.core.JsonProcessingException;
import com.hnzq.cloud.dto.*;
import com.hnzq.cloud.model.Result;
import com.hnzq.cloud.param.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;



@FeignClient(value = "fresh-order-assembly",contextId = "OrderAPI",path = "freOrder")
public interface OrderAPI {

    /**
     * 新增订单
     * @param addOrderParam
     * @return
     */
    @PostMapping("addOrder")
    public Result<AddOrderDto> addOrder(@RequestBody AddOrderParam addOrderParam);

    /**
     * 分页条件查询订单（用户订单展示）
     * @param findOrderParam
     * @return
     */
    @GetMapping("findOrderByCondition")
    public Result<PageOrdersDto> findOrderByCondition(@RequestBody FindOrderParam findOrderParam);



    /**
     * 根据单个订单id查询订单
     * @param orderId
     * @return
     */
    @GetMapping("findOrderByOrderId")
    public Result<OrderDto> findOrderByOrderId(@RequestParam("orderId") Integer orderId);

    /**
     * 修改订单状态
     * @param updateOrderStatusParam
     * @return
     */
    @PutMapping("updateOrderStatus")
    public Result<UpdateOrderStatusDto> updateOrderStatus(@RequestBody UpdateOrderStatusParam updateOrderStatusParam) throws JsonProcessingException;


    /**
     * 删除订单(逻辑删除)
     * @param removeOrderParam
     * @return
     */
    @DeleteMapping("removeOrder")
    public Result<Boolean> removeOrder(@RequestBody RemoveOrderParam removeOrderParam) throws JsonProcessingException;

    /**
     * 根据单个站点id查询所有订单
     * @param findOrderBySiteIdParam
     * @return
     */
    @GetMapping("findOrderBySiteId")
    public Result<PageOrdersDto> findOrderBySiteId(@RequestBody FindOrderBySiteIdParam findOrderBySiteIdParam);



    /**
     * 根据多个站点id查询所有订单
     * @param findOrderBySiteIdListParam
     * @return
     */
    @GetMapping("findOrderBySiteIdList")
    public Result<PageOrdersDto> findOrderBySiteIdList(@RequestBody FindOrderBySiteIdListParam findOrderBySiteIdListParam);




    /**
     * 模拟支付宝支付
     * @return
     */
    @PutMapping("payForZFB")
    public Result<String> payForZFB(@RequestParam("orderId") Integer orderId) throws JsonProcessingException;

    /**
     * 模拟微信支付
     * @return
     */
    @PutMapping("payForWX")
    public Result<String> payForWX(@RequestParam("orderId") Integer orderId) throws JsonProcessingException;


    /**
     * 判断所有order是否存在所有id列
     * @param judgeOrderIdsParam
     * @return
     */
    @PostMapping("judgeOrderIds")
    public Result<Boolean> judgeOrderIds(@RequestBody JudgeOrderIdsParam judgeOrderIdsParam);


    /**
     * 修改多个订单的状态
     * @param updateOrderListStatusParam
     * @return
     */
    @PutMapping("updateOrderListStatus")
    public Result<Integer> updateOrderListStatus(@RequestBody UpdateOrderListStatusParam updateOrderListStatusParam);


    /**
     * 取消订单
     * @param cancelOrderByOrderIdParam
     * @return
     */
    @PutMapping("cancelOrderByOrderId")
    public Result<String> cancelOrderByOrderId(@RequestBody CancelOrderByOrderIdParam cancelOrderByOrderIdParam);
}
